<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
	"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<title>Shopcastr</title>
	<link rel="stylesheet" href="css/master.css" type="text/css" media="screen" title="" charset="utf-8">
	<link rel="stylesheet" href="css/prettyPhoto.css" type="text/css" media="screen" title="" charset="utf-8">


	
	<script src="js/jq.js"></script>
	<script src="js/jquery.prettyPhoto.js"></script>
	
	<script>
		var controller = {
			url : null,
			current_url : null,
			bag : [],
			result : null,
			appId : "eUrkdP7V34GvIDbSM2QW3CwifcV1HijgNNgRdFlEJ.h1.ooCrjMK3rqibXpXKL5tZM0-",
			
			init: function(selection){
								
				this.addToBag(selection);
			},
						
			dataLoad: function(type,query){
				
				switch(type){
					
					case 'catalog':
					section = "catalogListing";
					version = "V2";
					optional = "&catalogid=1994289313";
					break;
					
					case 'product':
					section = "productSearch";
					version = "v3";
					break;
					
				}				
				
				var url = "&query="+query+"&output=json"+optional;
				url = escape(url);
				
				$.getJSON("comm/data.php?url=http://shopping.yahooapis.com/ShoppingService/"+version+"/"+section+"?appid="+this.appId+""+url, function(json){
				  controller.result = json;
				});				
			
			},
			
			addToBag: function(selection){
				
				console.log("Selected: "+selection+" From: "+this.current_url)
				
				this.bag.push(this.current_url+":"+selection);
			},
			
			goURL: function(pass){
				if(pass == "void"){
					this.url = $('#url').val();
				} else {
					this.url = pass;
				}
				console.log('goURL: '+this.url);
				$("#content").attr("src",this.url);
			}, 
			
			cur_loc: function(){
				$(document).ready(function(){
					console.log('here')
					var loc = parent.location.href;
					console.log(loc);
				});
			}
			
		}
				
		$(document).ready(function(){
									
			$("a[rel^='prettyPhoto']").prettyPhoto({
				animationSpeed: 'normal', /* fast/slow/normal */
				padding: 40, /* padding for each side of the picture */
				opacity: 0.35, /* Value betwee 0 and 1 */
				showTitle: true, /* true/false */
				allowresize: true, /* true/false */
				counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
				theme: 'light_rounded', /* light_rounded / dark_rounded / light_square / dark_square */
				callback: function(){}
			});
			
			//controller.current_url = setInterval(controller.cur_loc, 200);
			
			
			
		});

		
		
	</script>
	
</head>

<body>


	<?php include "shopcastr.php"; ?>

	<div id="results">
		<a href="#" onclick="javascript:controller.dataLoad('product','ipod')">Product Search</a>
		<a href="#" onclick="javascript:controller.dataLoad('catalog','')">Bring Catalogs</a>
	</div>
	
	

</body>
</html>
